package com.star.star.utils;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.youth.banner.loader.ImageLoader;

/**
 * @author Atom
 * @date 2017/8/5
 * @description Banner的ImageLoader
 */

public class GlideImageLoader extends ImageLoader {
    String type;

    public GlideImageLoader(String type) {//标记来源
    this.type=type;
    }

    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {

        if(!"SplashActivity".equals(type)){
            //Glide 加载图片简单用法
            Glide.with(context)
                    .load(path)
//                    .placeholder(R.mipmap.lbtzw)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(imageView);
        }else{
            Glide.with(context)
                    .load(path)
//                    .placeholder(R.mipmap.lbtzw)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(imageView);
        }
    }
}
